import request from '@/utils/request'

// 查询检索条件&数据列表
export function dataListPage (query) {
  return request({
    url: '/form/data/listpage',
    method: 'get',
    params: query
  })
}

export function deleteKnowLedge (id) {
  console.log('-------deleteKnowLedge---------')
  console.log(id)
  return request({
    url: '/form/data/deleteKnowLedge/' + id,
    method: 'delete'
  })
}

export function getKnowLedgeInfo (id) {
  return request({
    url: '/form/data/getKnowLedgeInfo/' + id,
    method: 'get'
  })
}
// 复杂属性获取 tplId,parentId
export function getJson (query) {
  return request({
    url: '/form/data/getJson',
    method: 'get',
    params: query
  })
}
// 新增时获取生成mongoId
export function newDataId() {
  return request({
    url: '/form/data/newDataId',
    method: 'get',
  })
}
// 保存数据条目（new）
export function saveKnowLedge (data) {
  return request({
    url: '/form/data/saveKnowLedge',
    method: 'post',
    data: data
  })
}
// 根据子表条目id获取数据
export function getJsonById (query) {
  return request({
    url: '/form/data/getJsonById',
    method: 'get',
    params: query
  })
}
// 子表条目保存
export function saveJson (data, tplId, parentId) {
  return request({
    url: '/form/data/saveJson?tplId=' + tplId + '&parentId=' + parentId,
    method: 'post',
    data: data
  })
}
// 删除复杂属性数据
export function delJsonById (ids) {
  return request({
    url: '/form/data/delJsonById/' + ids,
    method: 'delete'
  })
}
// 向上向下移动
export function editUpOrDown (tplId, parentId, id, type) {
  return request({
    url: '/form/data/editUpOrDown/' + tplId + '/' + parentId + '/' + id + '/' + type,
    method: 'post',
  })
}




